![]() |
WOLF core
WOLF: A Modular Estimation Framework for Robotics
|
TimeStamp implements basic functionalities for time stamps. More...
#include <core/common/time_stamp.h>
Public Member Functions | |
| TimeStamp () | |
| Default constructor: zero and not valid time stamp. More... | |
| TimeStamp (const TimeStamp &_ts) | |
| Copy constructor. More... | |
| TimeStamp (const double &_ts) | |
| Constructor from seconds (not valid if negative) More... | |
| TimeStamp (const unsigned long int &_sec, const unsigned long int &_nsec) | |
| Constructor from sec and nsec. More... | |
| ~TimeStamp () | |
| Destructor. More... | |
| bool | ok () const |
| Returns whether the time stamp has a valid value. More... | |
| void | setOk () |
| Sets the time stamp as valid. More... | |
| void | setNOk () |
| Sets the time stamp as not valid. More... | |
| void | setToNow () |
| Sets the time stamp to now (valid) More... | |
| void | set (const timeval &ts) |
| Set time stamp. More... | |
| void | set (const unsigned long int &sec, const unsigned long int &nanosec) |
| Set time stamp. More... | |
| void | set (const double &ts) |
| Set time stamp. More... | |
| double | get () const |
| Get time stamp. More... | |
| unsigned long int | getSeconds () const |
| Get time stamp (only seconds) More... | |
| unsigned long int | getNanoSeconds () const |
| Get time stamp (only nano seconds) More... | |
| void | operator= (const double &ts) |
| Assignment operator given a scalar_t (seconds), not valid if negative. More... | |
| void | operator= (const TimeStamp &ts) |
| Assignment operator. More... | |
| bool | operator!= (const TimeStamp &ts) const |
| Inequality operator. More... | |
| bool | operator== (const TimeStamp &ts) const |
| Equality operator. More... | |
| bool | operator< (const TimeStamp &ts) const |
| Less than operator. More... | |
| bool | operator> (const TimeStamp &ts) const |
| Greater than operator. More... | |
| bool | operator<= (const TimeStamp &ts) const |
| Less or equal than operator. More... | |
| bool | operator>= (const TimeStamp &ts) const |
| Greater or equal than operator. More... | |
| void | operator+= (const double &dt) |
| Add-assign operator given a scalar_t (seconds) More... | |
| TimeStamp | operator+ (const double &dt) const |
| Addition operator given a scalar_t (seconds) More... | |
| void | operator-= (const double &dt) |
| Subtraction-assign operator given a scalar_t (seconds). Not valid if the result would be negative. More... | |
| TimeStamp | operator- (const double &ts) const |
| Subtraction operator given a scalar_t (seconds), returning a TimeStamp. More... | |
| double | operator- (const TimeStamp &ts) const |
| Difference operator, returning a scalar_t (seconds) More... | |
| void | print (std::ostream &ost=std::cout) const |
| Prints time stamp to a given ostream. More... | |
| std::string | string () const |
| Returns a string with the Timestamp. More... | |
Static Public Member Functions | |
| static TimeStamp | Invalid () |
| Returns a not valid time stamp. More... | |
| static TimeStamp | Now () |
| Returns a time stamp set to now. More... | |
Protected Attributes | |
| unsigned long int | time_stamp_nano_ |
| Time stamp. Expressed in nanoseconds since 1st Jan 1970. More... | |
| bool | is_valid_ |
| Whether the time stamp has a valid value. More... | |
Friends | |
| std::ostream & | operator<< (std::ostream &os, const TimeStamp &_ts) |
| Prints the time stamp to a stream. More... | |
TimeStamp implements basic functionalities for time stamps.
TimeStamp implements basic functionalities for time stamps
| wolf::TimeStamp::TimeStamp | ( | ) |
Default constructor: zero and not valid time stamp.
| wolf::TimeStamp::TimeStamp | ( | const TimeStamp & | _ts | ) |
Copy constructor.
Copy constructor
| wolf::TimeStamp::TimeStamp | ( | const double & | _ts | ) |
Constructor from seconds (not valid if negative)
| wolf::TimeStamp::TimeStamp | ( | const unsigned long int & | _sec, |
| const unsigned long int & | _nsec | ||
| ) |
Constructor from sec and nsec.
Constructor from sec and nsec
| wolf::TimeStamp::~TimeStamp | ( | ) |
Destructor.
Destructor
|
inline |
Get time stamp.
Returns time stamp
|
inline |
Get time stamp (only nano seconds)
Returns nanoseconds part of time stamp
|
inline |
Get time stamp (only seconds)
Returns seconds of time stamp
|
inlinestatic |
Returns a not valid time stamp.
|
static |
Returns a time stamp set to now.
|
inline |
Returns whether the time stamp has a valid value.
|
inline |
Inequality operator.
| TimeStamp wolf::TimeStamp::operator+ | ( | const double & | dt | ) | const |
Addition operator given a scalar_t (seconds)
|
inline |
Add-assign operator given a scalar_t (seconds)
| TimeStamp wolf::TimeStamp::operator- | ( | const double & | ts | ) | const |
Subtraction operator given a scalar_t (seconds), returning a TimeStamp.
|
inline |
Difference operator, returning a scalar_t (seconds)
| void wolf::TimeStamp::operator-= | ( | const double & | dt | ) |
Subtraction-assign operator given a scalar_t (seconds). Not valid if the result would be negative.
|
inline |
Less than operator.
|
inline |
Less or equal than operator.
|
inline |
Assignment operator given a scalar_t (seconds), not valid if negative.
|
inline |
Assignment operator.
|
inline |
Equality operator.
|
inline |
Greater than operator.
|
inline |
Greater or equal than operator.
| void wolf::TimeStamp::print | ( | std::ostream & | ost = std::cout | ) | const |
Prints time stamp to a given ostream.
Prints time stamp to a given ostream
|
inline |
Set time stamp.
Sets time stamp to a given value passed as a scalar_t (seconds)
|
inline |
Set time stamp.
Sets time stamp to a given value passed as a timeval struct
|
inline |
Set time stamp.
Sets time stamp to a given value passed as a two-integer (seconds and nanoseconds)
|
inline |
Sets the time stamp as not valid.
|
inline |
Sets the time stamp as valid.
| void wolf::TimeStamp::setToNow | ( | ) |
Sets the time stamp to now (valid)
|
inline |
Returns a string with the Timestamp.
To be used by the logger
|
friend |
Prints the time stamp to a stream.
|
protected |
Whether the time stamp has a valid value.
|
protected |
Time stamp. Expressed in nanoseconds since 1st Jan 1970.